package user

import (
	"cross-shard-channel/common"
	"github.com/eywa-protocol/bls-crypto/bls"
)

// the reject message
type OpenReject struct {
	Cid int
}

type CloseReject struct {
	Cid int
}

type UpdateReject struct {
	Cid int
}

// Open Message
type InitOpen struct {
	Cid int
	InputUTXOA common.UTXO
	ChannelPubA bls.PublicKey
	AdvBalance int
	LifeTime int
}

type InitOpenResponse struct {
	Cid int
	InputUTXOB common.UTXO
	ChannelPubB bls.PublicKey
	ChannelPubFinal bls.PublicKey
}

type OpenNotify struct {
	Cid int
	TxNotify common.Transaction
}

type OpenNotifyResponse struct {
	Cid int
	TxNotify common.Transaction
}

type OpenAccount struct {
	Cid int
	LockPub bls.PublicKey
}

type OpenAccountResponse struct {
	Cid int
	LockPub bls.PublicKey
}

type OpenUnlock struct {
	Cid int
	TxCommitB common.Transaction
	TxUnlockB common.Transaction
	Sig bls.Signature
}

type OpenUnlockResponse struct {
	Cid int
	TxCommitA common.Transaction
	TxUnlockA common.Transaction
	Sig bls.Signature
}


type OpenCommit struct {
	Cid int
	MainSigA bls.Signature
	ChSigA bls.Signature
	NotifySigA bls.Signature
}

type OpenCommitResponse struct {
	Cid int
	MainSigB bls.Signature
	ChSigB bls.Signature
	NotifySigB bls.Signature
}


type OpenCreate struct {
	Cid int
	SigA bls.Signature
}

type OpenCreateResponse struct {
	Cid int
	SigB bls.Signature
}


// Update Message
type InitUpdate struct {
	Cid int
	Value int
	LockPub bls.PublicKey
}

type InitUpdateResponse struct {
	Cid int
	LockPub bls.PublicKey
	Ack bool
}

type UpdateUnlock struct {
	Cid int
	TxCommitB common.Transaction
	TxUnlockB common.Transaction
	Sig bls.Signature
	Value int
}

type UpdateUnlockResponse struct {
	Cid int
	TxCommitA common.Transaction
	TxUnlockA common.Transaction
	Sig bls.Signature
}

type UpdateCommit struct {
	Cid int
	MainSigA bls.Signature
	ChSigA bls.Signature
	NotifySigA bls.Signature
}

type UpdateCommitResponse struct {
	Cid int
	MainSigB bls.Signature
	ChSigB bls.Signature
	NotifySigB bls.Signature
}

type UpdateKeyExchange struct {
	Cid int
	Pri bls.PrivateKey
}

type UpdateKeyExchangeResponse struct {
	Cid int
	Pri bls.PrivateKey
}

// close
type InitClose struct {
	Cid int
}

type InitCloseResponse struct {
	Cid int
	Ack bool
}

type CloseCreate struct {
	Cid int
	TxClose common.Transaction
	MainSigA bls.Signature
	ChSigA bls.Signature
	NotifySigA bls.Signature
}

type CloseCreateResponse struct {
	Cid int
	MainSigB bls.Signature
	ChSigB bls.Signature
	NotifySigB bls.Signature
}